<?php

/**
 * Created by PhpStorm.
 * User: dung
 * Date: 3/26/14
 * Time: 2:02 PM
 */
class Model_Video extends Zend_Db_Table
{
    protected $_name = 'film_data';
    protected $_primary = 'data_id';

    public function countItem($arrParams = null, $options = null)
    {
        $db = Zend_Registry::get('connectDb');
        $select = $db->select()->from('film_data AS v', array('COUNT(data_id)'));
        if (isset($arrParams['conditions']) && !empty($arrParams['conditions'])) {
            $conditions = $arrParams['conditions'];
            foreach ($conditions as $condition) {
                $select->where($condition['key'], $condition['exp'], $condition['value']);
            }
        }
        $result = $db->fetchOne($select);
        return $result;
    }

    public function getNewVideo($arrParams = null, $number = 10, $options = null)
    {
//        $db = Zend_Registry::get('connectDb');
//        $select = $db->select()
//            ->from('film_data as v',$arrParams['fields'])
//            ->
    }
} 